<template>
  <FormItem :label="label" :prop="prop" :single="single">
    <Switch :model-value="modelValue" true-value="1" false-value="0" :disabled="see || disabled" @change="change">
      <span slot="open">{{ label }}</span>
      <span slot="close">{{ label }}</span>
    </Switch>
  </FormItem>
</template>
<script>
export default {
  name: "FormSwitch",
  props: {
    label: "",
    prop: "",
    modelValue: {},
    single: {
      default: false
    },
    icon: {
      default: ""
    },
    readonly: {
      default: false
    }
  },
  computed: {
    see() {
      return this.$store.forms.see;
    }
  },
  methods: {
    change(data) {
      this.$emit("update:modelValue", data.value);
      this.$emit("change", data);
    }
  }
};
</script>